<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<title>现场挂号</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<script type="text/javascript">
function setCost(){
	var cost = document.getElementById("cost");
	var $type=$("#registlevel").val();
	$.ajax({
		url:"GetCostServlet",
		请求方式:"post",
		data:"type="+$type,
		success:function(result,testStatus){
			cost.value=result;
		},
		error :function(){		}
	})
	
	
}

function check(){
	var form = document.getElementById("form-member-add");
	form.submit();
	return true;
}
</script> 
<body>
<article class="page-container">
	<form action="RegistServlet" method="post" class="form form-horizontal" id="form-member-add"  onsubmit="return check()" >
		<div class="row cl">
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>病人身份证号：</label>
			
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" class="input-text" value="" placeholder="" id="patientNum" name="patientNum" >
			</div>
			<!-- 先查询该病人原来是否就诊若就诊就将原有病人信息调出来若没有就重新输入。-->
			<div class="formControls col-xs-2 col-sm-2">
				<input class="btn btn-primary radius" type="button"  onclick="getPatient()" value="&nbsp;&nbsp;查询&nbsp;&nbsp;">
			</div>
			
			<div class="formControls col-xs-2 col-sm-2">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;挂号&nbsp;&nbsp;">
			</div>
			
			<div class="formControls col-xs-2 col-sm-2">
				<input class="btn btn-primary radius" type="reset" value="&nbsp;&nbsp;清空&nbsp;&nbsp;">
			</div>	
					
			<label class="form-label col-xs-5 col-sm-5"></label>
		</div>
		
		
		<div class="row cl">
			<label class="form-label col-xs-1 col-sm-1">病人信息</label>
			<label class="form-label col-xs-11 col-sm-11"></label>
		</div>
		
		
		<div class="row cl">
		
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>姓名：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" class="input-text" placeholder="" id="patientName" name="patientName">
			</div>
			
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<span class="select-box">
					<select class="select" id="patientSex" name="patientSex">
					<option value = "71">男</option>
					<option value = "72">女</option>
					</select>
				</span>
			</div>
			
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>年龄：</label>
			<div class="formControls col-xs-1 col-sm-1">
				<input type="text" class="input-text" value="" placeholder="" id="patientAge" name="patientAge">
			</div>
			
			
			<div class="formControls col-xs-1 col-sm-1">
				<span class="select-box"><select class="select" id="patientAgeType" name="patientAgeType">
					<option value="岁">岁</option>
					<option value="月">月</option>
					<option value="日">日</option>
				</select></span>
			</div>
			
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>家庭住址：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" class="input-text" value="" placeholder="" id="patientAddress" name="patientAddress">
			</div>		
		</div>
			
		<div class="row cl">
			<label class="form-label col-xs-1 col-sm-1">出生年月：</label>
			<div class="formControls col-xs-2 col-sm-2">
			<input type="text" onfocus="WdatePicker()" id="patientBirthday" name="patientBirthday" class="input-text Wdate" style="width:120px;">
			</div>			
		</div>	
			
			
		<!--本次挂号信息  -->	
		<div class="row cl">
			<label class="form-label col-xs-1 col-sm-1">挂号信息</label>
			<label class="form-label col-xs-11 col-sm-11"></label>
		</div>
		
	<!--
		<div class = "row cl">		
			<label class="form-label col-xs-1 col-sm-1">挂号日期：</label>
			<div class="formControls col-xs-2 col-sm-2">
			<input type="text" onfocus="WdatePicker()" id="registerDate" class="input-text Wdate" style="width:120px;">
			</div>		
			
		  -->	
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>午别：</label>
			
			<div class="formControls col-xs-2 col-sm-2">
				<span class="select-box"><select class="select" name="noon" id="noon">
					<option value="上午">上午</option>
					<option value="下午">下午</option>
				</select></span>
			</div>
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>挂号科室：</label>
			<div class="formControls col-xs-2 col-sm-2">
				 <span class="select-box"  >
				<select class="select" id="department" name="department" onclick="getDepartment()" >
					
				</select>
				</span>
			</div>
			
			
			
			<label class="form-radio col-xs-1 col-sm-1"><span class="c-red">*</span>挂号级别</label>			
			<div class="formControls col-xs-2 col-sm-2">
				<span class="select-box" >
				<select class="select" name="registlevel" id="registlevel" onclick="setCost()" >
					<option value="2">普通号</option>
					<option value="1">专家号</option>
				</select></span>
			</div>
			
			
			<div class="row cl">
		
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>挂号医生：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<span class="select-box" id = "doctorNum">
				<select class="select" id="doctor" name = "doctor" onclick="getDoctor()">
					
				</select>
				</span>			
		
			</div>
			
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>是否要病历本：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<span class="select-box">
				<select class="select" name="whetherMedical" id="whetherMedical">
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
				</span>			
			</div>
			
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>挂号费用：</label>
			<div class="formControls col-xs-1 col-sm-1">
				<input type="text" class="input-text" placeholder="" id="cost" name="cost" value="8.0">
			</div>
			
			
			
			</div>		
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>

<script type="text/javascript">


</script>
<script type="text/javascript">	
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#id option:first").prop("selected", 'selected');
	
	
	$("#form-member-add").validate({
		rules:{
			username:{
				required:true,
				minlength:2,
				maxlength:16
			},
			sex:{
				required:true,
			},
			mobile:{
				required:true,
				isMobile:true,
			},
			email:{
				required:true,
				email:true,
			},
			uploadfile:{
				required:true,
			},
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			//$(form).ajaxSubmit();
			var index = parent.layer.getFrameIndex(window.name);
			//parent.$('.btn-refresh').click();
			parent.layer.close(index);
		}
	});
});
function getPatient(){
	var $patientNum=$("#patientNum").val();
	$.getJSON(
			"GetPatientServlet",
			{"patientNum":$patientNum},
			function(result){
				var patient = eval(result.patient);
				if(patient != null){
					document.getElementById("patientName").value=patient.name;
					document.getElementById("patientAge").value=patient.age;
					document.getElementById("patientAddress").value=patient.address;
					document.getElementById("patientBirthday").value=patient.birthday;
					
					if(patient.sex == 71)
						document.getElementById("patientSex").options[0].selected = true;
					else
						document.getElementById("patientSex").options[1].selected = true;
					
					if(patient.ageType == "岁")
						document.getElementById("patientAgeType").options[0].selected = true;
					else if(patient.ageType == "月")
						document.getElementById("patientAgeType").options[1].selected = true;
					else
						document.getElementById("patientAgeType").options[2].selected = true;
	
				}
					
			}
	);
	
}

function getDepartment(){
	 var selections = document.getElementById("department");
	 selections.innerHTML = "";
		for(var i=0;i<selections.childNodes.length;i++){
			selections.removeChild(area.options[0]);
			selections.remove(0);
			selections.options[0] = null;
		}
	$.getJSON(
			"GetDepartmentServlet",
			function(result){
				var departments = eval(result);
				$.each(departments,
						function(i,element)
						{
							//设置下拉列表中的值的属性
		                   var option = document.createElement("option");
		                   option.value = this.id;
		                   option.text= this.name;
		                   //将option增加到下拉列表中。
		                    selections.add(option);
						});
			}
	);
}
function getDoctor(){
	var selections = document.getElementById("doctor");
	var $department=$("#department").val();
	var $registlevel=$("#registlevel").val();
	selections.innerHTML = "";

	for(var i=0;i<selections.childNodes.length;i++){
		selections.removeChild(area.options[0]);
		selections.remove(0);
		selections.options[0] = null;
	}
	$.getJSON(
			"GetDoctorServlet",
			{"department":$department,"registlevel":$registlevel},
			function(result){
				var users = eval(result);
				$.each(users,
						function(i,element)
						{
		                   var option = document.createElement("option");
		                   option.value = this.id;
		                   option.text= this.name;
		                    selections.add(option);
						});
			}
	);
	selections.value = "";
}



</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>



</html>